<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div {
            width: 200px;
            height: 200px;
            border: 5px dashed red;
            background-color: rgb(255, 255, 224);
            margin: 0 auto;
        }

        p {
            text-align: center;
        }
    </style>
</head>
<body>
    <div>
        <p>文本和块状元素居中</p>
    </div>
</body>
</html>